//
//  ListItemTableViewCell.m
//  ZooNgonDoiOS
//
//  Created by Trung sound on 7/5/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "ListItemTableViewCell.h"
#import "UIImage+Crop.h"

@implementation ListItemTableViewCell
@synthesize vImgItem = _vImgItem;
@synthesize lbAddress = _lbAddress;
@synthesize lbDistance = _lbDistance;
@synthesize lbNameItem = _lbNameItem;
//@synthesize obManager = _obManager;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        UIImageView *line = [[UIImageView alloc]initWithImage:[UIImage imageNamed:IMG_LINE_HOME]];
        line.frame = CGRectMake(0, 0, 296, 2);
        
        _vImgItem = [[HJManagedImageV alloc]initWithFrame:CGRectMake(0, 2, 296, 150)];
        _vImgItem.backgroundColor = [UIColor grayColor];
//        _vImgItem.image = [_vImgItem.image imageByScalingAndCroppingForSize:CGSizeMake(296, 70)];
//        _obManager = [[HJObjManager alloc]initWithLoadingBufferSize:2 memCacheSize:2];
//        [_obManager manage:_vImgItem];
        
//        NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/ngondo/"] ;
//        HJMOFileCache* fileCache = [[[HJMOFileCache alloc] initWithRootPath:cacheDirectory] autorelease];
//        _obManager.fileCache = fileCache;
        
        _vNameItem = [[UIView alloc]initWithFrame:CGRectMake(0, 117, 296, 35)];
        _vNameItem.backgroundColor = [UIColor blackColor];
        _vNameItem.alpha = 0.7;
        
        _lbNameItem = [[UILabel alloc]initWithFrame:CGRectMake(5, 117, 290, 35)];
        [_lbNameItem setBackgroundColor:[UIColor clearColor]];
        [_lbNameItem setTextColor:[UIColor whiteColor]];

        _lbAddress = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 240, 20)];
        [_lbAddress setBackgroundColor:[UIColor clearColor]];
        
        _lbDistance = [[UILabel alloc]initWithFrame:CGRectMake(220, 0, 80, 20)];
        [_lbDistance setBackgroundColor:[UIColor clearColor]];
        
        _vFooter = [[UIView alloc]initWithFrame:CGRectMake(0, 152, 296, 26)];
        [_vFooter setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:IMG_ADDRESS_BACKGROUND]]];

        
//        [_vNameItem addSubview:_lbNameItem];
        [_vFooter addSubview:_lbAddress];
        [_vFooter addSubview:_lbDistance];
        
        [self addSubview:line];
        [self addSubview:_vImgItem];
        [self addSubview:_vNameItem];
        [self addSubview:_lbNameItem];
        [self addSubview:_vFooter];
        
        [_vImgItem release];
        [line release];
    }
    return self;
}

- (void) viewDidLoad {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
